package com.xzy.controller;

import com.xzy.entity.Content;
import com.xzy.service.ContentService;
import com.xzy.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ContentController {

    @Autowired
    private ContentService contentService;

@PostMapping("/zreport/content/addContent/{reportId}")
    public JSONResult addContent(Content content, @PathVariable("reportId") int reportId)
    {
        content.setReportId(reportId);
        contentService.addContent(content);
        return JSONResult.SUCCESS(content);
    }
    @GetMapping("/zreport/content/getContentByReport/{reportId}")
    public JSONResult getContentByReport(@PathVariable("reportId")int reportId)
    {
        List<Content> contentList=contentService.getContentByReport(reportId);
        return  JSONResult.SUCCESS(contentList);
    }
}
